
<template>
  <div style="height:100%;width:100%;position:relative;">
      <div class="pagecenter">
          <div style="height:100%;width:100%">
              <el-image style="width: 100%; height: 360px" fits="fill" :src="imgurl"></el-image>
              <div style="position:relative;top:-160px;left:300px;color:white;z-index:999;width:300px;">
                  <table>
                      <tr>
                          <td align="right" style="color:white;width:80px;">用户名：</td>
                          <td>
                              <el-input v-model="userno" disabled></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td align="right" style="color:white;">密&nbsp;&nbsp;&nbsp;码：</td>
                          <td>
                              <el-input v-model="password" ref="userpwd" type="password" show-password :autofocus="true"></el-input>
                          </td>
                      </tr>
                      <tr>
                          <td colspan="2" align="right">
                              <el-button class="mybtnclass" @click.native="btnUnLock" icon="el-icon-unlock">解锁</el-button>
                              <el-button class="mybtnclass" @click.native="btnLogoff" icon="el-icon-switch-button">注销</el-button>
                              <el-button class="mybtnclass" @click.native="btnClose" icon="el-icon-close">退出</el-button>
                          </td>
                      </tr>
                  </table>
              </div>
          </div>
      </div>
  </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
import md5 from "js-md5";
export default {
  name: "rm_scurityalertinfo",
  data() {
      return {
          imgurl: require("@/assets/img/about.jpg"),
          userno: this.$tool.getSession(this.$tool.loginuserno),
          password: "",
      };
  },
  created() {
      //this.InitPageDate(); //初始化主列表
      //this.getinitdata(); //初始化下拉框的数据
      //console.log("sa", this.$tool.getSession(this.$tool.loginuserno));
      // 修正当没有登录时(userno=null时)弹窗的问题
      //console.log(this.userno);
      if (!this.userno) this.$emit("change", "logoff");
  },
  mounted() {
      if (this.$refs.userpwd) {
          this.$refs.userpwd.focus();
      }
  },
  updated() {},
  methods: {
      btnUnLock() {
          this.$tool
              .request({
                  url: "/ucent/login",
                  method: "post",
                  data: {
                      action: "Nlogin",
                      password: md5("rms-" + this.password + "-rme"),
                      userno: this.userno,
                  },
              })
              .then((resp) => {
                  if (resp.flag != 1) {
                      //登录失败TODO
                      this.$alert("登录失败！！" + resp.msg, "错误", {
                          confirmButtonText: "确定",
                      });
                  } else {
                      //登录成功TODO
                      this.$emit("change", "unlock");
                  }
              })
              .catch((e) => {
                  this.$alert(e, "提示");
              });
      },
      btnLogoff() {
          this.$router.push("/login");
          this.$emit("change", "logoff");
      },
      btnClose() {
          var res = jsObj.CloseWindow();
          if (res) this.$emit("change", "close");
      },
  },
};
</Script>

<style scoped>
.pagecenter {
  position: absolute;
  top: 0px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}
table {
  font-size: 16px;
  border-collapse: separate;
  border-spacing: 10px;
}
::v-deep .mybtnclass {
  width: 65px;
  height: 30px;
}
</style>
